<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Storage;
use function Symfony\Component\String\s;


class PostsLikes extends Model
{
    use HasFactory;
    //use SoftDeletes;

    static $unguarded = true;
    protected $table = 'posts_likes';

    public function post(): \Illuminate\Database\Eloquent\Relations\HasOne
    {
        return $this->hasOne(Posts::class,'id','post_id');
    }


    public static function countLike($where)
    {
        $data = self::query();
        return $data->where($where)->count();

    }
}
